<template>
  <div class="container">
      <!--上面标题-->
        <div class="title">
          <span>体能测试报表</span>
        </div>
        <!--下面内容-->
        <div class="content">
          <!--左边的-->
          <div class="left">
              <div class="leftOne"></div>
              <div class="leftTwo"></div>
              <div class="leftThree"></div>
              <div class="leftFour"></div>
          </div>
          <!--中间的-->
          <div class="center">
              <div class="centerOne"></div>
              <div class="centerTwo"></div>
          </div>

          <!--右边的-->
          <div class="right">
              <div class="rightOne"></div>
              <div class="rightTwo"></div>
              <div class="rightThree"></div>
          </div>
        </div>

        <!--时间显示-->
        <div class="timer">
          <span class="date">{{yy}}</span><span class="date">年</span>
          <span class="date">{{mm}}</span><span class="date">月</span>
          <span class="date">{{dd}}</span><span class="date">日</span>
          <span class="date">{{hh}}</span><span class="date">:</span>
          <span class="date">{{mf}}</span><span class="date">:</span>
          <span class="date">{{ms}}</span>
          <span class="date">星期</span><span class="date">{{nowWeek}}</span>
        </div>
  </div>
</template>

<script>
  export default {
    name: "firePicture2",
    data() {
      return {
        color1: '#071022',
        nowWeek: '', // 当前星期
        yy: '',//年
        mm: '',//月
        dd: '',//日
        hh: '',//时
        mf: '',//分
        ms: '',//秒

      }
    }, mounted() {
      this.currentTime()
    }, methods: {
      // 每0.5秒执行一次
      currentTime() {
        setInterval(this.getDate, 500)
        setInterval(this.monitorTime, 1000)
      },
      // 获取当前日期时间的方法
      getDate() {
        var _this = this
        //获取年
        let yy = new Date().getFullYear()
        //获取月,注意时间是0-11，0代表1月份
        let mm = new Date().getMonth() + 1
        // 获取具体哪一天
        let dd = new Date().getDate()
        // 获取星期 0-6 0是星期天
        let week = new Date().getDay()
        //获取小时
        let hh = new Date().getHours()
        //获取秒钟
        let ms =
          new Date().getSeconds() < 10
            ? '0' + new Date().getSeconds()
            : new Date().getSeconds()
        // 获取分钟
        let mf =
          new Date().getMinutes() < 10
            ? '0' + new Date().getMinutes()
            : new Date().getMinutes()
        // 获取星期
        if (week == 1) {
          this.nowWeek = '一'
        } else if (week == 2) {
          this.nowWeek = '二'
        } else if (week == 3) {
          this.nowWeek = '三'
        } else if (week == 4) {
          this.nowWeek = '四'
        } else if (week == 5) {
          this.nowWeek = '五'
        } else if (week == 6) {
          this.nowWeek = '六'
        } else {
          this.nowWeek = '日'
        }
        _this.nowTime = hh + ':' + mf + ':' + ms
        _this.nowDate = yy + '年' + mm + '月' + dd + '日'
        _this.yy = yy
        _this.mm = mm
        _this.dd = dd
        _this.hh = hh
        _this.mf = mf
        _this.ms = ms
      },
    }
  }
</script>

<style>
  * {
    margin: 0;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
  }

  .container {
    width: 100%;
    height: 100%;
    background-color: #14315B;
    position: relative;
  }

  .timer {
    font-size: 16px;
    position: absolute;
    top: 7px;
    right: 50px;
  }

  .timer .date:nth-child(odd) {
    color: #2FA5FF;
  }

  .timer .date:nth-child(even) {
    color: #C1C3C8;
  }

  .timer .date:nth-child(6) {
    margin-right: 10px;
  }

  .timer .date:nth-child(11) {
    margin-right: 10px;
  }

  .left {
    margin-left: 1%;
    width: 25%;
    height: 100%;
    background-color: #071022;
  }

  .center {
    width: 50%;
    height: 100%;
    background-color: #b4bccc;
  }

  .right {
    margin-right: 1%;
    width: 25%;
    height: 100%;
    background-color: #071022;
  }
  .title{
    width: 100%;
    height: 10%;
    font-size: 28px;
    font-family: inherit;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .title span {
    text-align: center;
  }
  .content{
    display: flex;
    width: 100%;
    height: 90%;
  }
  .leftOne{
    width: 100%;
    height: 20%;
    background-color: red;
  }
  .leftTwo{
    width: 100%;
    height: 30%;
    background-color: bisque;
  }
  .leftThree{
    width: 100%;
    height: 30%;
    background-color: blueviolet;
  }
  .leftFour{
    width: 100%;
    height: 20%;
    background-color: aquamarine;
  }
  .centerOne{
    width: 100%;
    height: 70%;
    background-color: #1ab394;
  }
  .centerTwo{
    width: 100%;
    height: 30%;
    background-color: bisque;
  }
  .rightOne{
    width: 100%;
    height: 30%;
    background-color: bisque;
  }
  .rightTwo{
    width: 100%;
    height: 30%;
    background-color: brown;
  }
  .rightThree{
    width: 100%;
    height: 40%;
    background-color: forestgreen;
  }

</style>
